package com.le.tester.javaThink.fifth.chapter12_Collections;

import java.util.ArrayList;

/**
 * createTime：2021/8/24 16:00
 * description：GenericsAndUpcasting
 */

class GrannySmith extends Apple {
}

class Gala extends Apple {
}

class Fuji extends Apple {
}

class Braeburn extends Apple {
}

public class GenericsAndUpcasting {
    public static void main(String[] args) {
        ArrayList<Apple> apples = new ArrayList<>();
        apples.add(new GrannySmith());

        apples.add(new Gala());

        apples.add(new Fuji());
        apples.add(new Braeburn());

        for (Apple apple : apples) {
            System.out.println(apple);
        }
    }
}
